package fy;

import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
@Path("/helloWorld")
public class Hellwold {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String helloWorld(){
String ret = "Hello World!";
return ret;
}
/*@Path("/helloworld")
public class Hellwold {

	    @Context
	    HttpServletResponse response;

	    @GET
	    @Produces(MediaType.TEXT_PLAIN)
	    public String getResult(@QueryParam("name") String name){
	        return result(name);
	    }
	    
	    @POST
	    @Produces(MediaType.TEXT_PLAIN)
	    public String postResult(@QueryParam("name") String name){
	        return result(name);
	    }

	    private String result(String name){
	        response.setCharacterEncoding("UTF-8"); // 解决变量name含有中文时出现的乱码问题
	        return "My name is " + name + ", Hello World!";
	    }*/
	}

